package com.example.hangzhou.welbeing.mytestdemoapp.factory;


import android.support.v4.app.Fragment;

import com.example.hangzhou.welbeing.mytestdemoapp.fragment.MyDialogFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.MyProgressFragment;

import java.util.HashMap;

/**
 * 杭州惟君医疗科技有限公司09
 * Created by 20433 on 2018/5/15
 *
 * @desc 东风山河绿，春已不折柳，繁花看不尽，处处惹人留
 * @desc 佛祖镇楼，bug辟容易
 */

public class RecyclerViewFragmentFactory {
    private static final int PROGRESS = 0; //Progress
    private static final int DIALOG = 1;  //Dialog

    private static HashMap<Integer, Fragment> mapAll = new HashMap();
    public static Fragment CreateCircleObject(int position) {
        Fragment fragment = mapAll.get(position);
        if (fragment == null)
        {
            switch (position){
                case PROGRESS:
                    fragment = new MyProgressFragment();
                    break;
                case DIALOG:
                    fragment =  new MyDialogFragment();
                    break;
            }
            mapAll.put(position,fragment);
            return fragment;
        }
        return fragment;
    }
}
